#ifndef WIDGET_H
#define WIDGET_H

#include <QWidget>
#include <QMenu>
#include <QNetworkReply>
#include "citycodeutils.h"
#include "days.h"
#include <QList>
#include <QLabel>
#include <QMap>
QT_BEGIN_NAMESPACE
namespace Ui { class Widget; }
QT_END_NAMESPACE

class Widget : public QWidget
{
    Q_OBJECT
protected:
    //重写鼠标事件
    void mousePressEvent(QMouseEvent *event);
    //重写鼠标移动事件
    void mouseMoveEvent(QMouseEvent *event);
    //数据过滤器
    bool eventFilter(QObject *watched, QEvent *event);

public:
    Widget(QWidget *parent = nullptr);
    ~Widget();


public slots:
    void readData();

private slots:
    void on_pushButton_clicked();

    void on_lineEdit_01_search_returnPressed();

private:
    Ui::Widget *ui;
    QMenu *menu;
    QPoint mOffset;
    QNetworkReply *reply;
    QNetworkAccessManager *manager;
    QString urlPath;
    CityCodeUtils findCodeFromName;
    Days day[7];    //一个day数组，每个元素为Days类对象
    void setWeatherData(QByteArray data);
    void drawHighLine();
    void drawLowLine();
    //用于存储周天气图标
    QMap<QString,QString> weekIconMap;
    //用于存储当天天气图标
    QMap<QString,QString> currentIconMap;
    QList<QLabel *> weekList;
    QList<QLabel *> dateList;
    QList<QLabel *> iconList;
    QList<QLabel *> typeList;
    QList<QLabel *> airList;
    QList<QLabel *> fxList;
    QList<QLabel *> flList;
};
#endif // WIDGET_H
